﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Collections.ObjectModel;

namespace WpfExample
{
  public class Person : INotifyPropertyChanged
  {
    [Display(Order=6)]
    public string ReadOnlyProperty
    {
      get { return "This property always has readonly template because there's no setter."; }
    }

    [Display(Name="First name")]
    public string FirstName
    {
      get { return _FirstName; }
      set
      {
        if (_FirstName != value)
        {
          _FirstName = value;
          RaisePropertyChanged("FirstName");
        }
      }
    }
    private string _FirstName;

    [Display(Name="Last name")]
    public string LastName
    {
      get { return _LastName; }
      set
      {
        if (_LastName != value)
        {
          _LastName = value;
          RaisePropertyChanged("LastName");
        }
      }
    }
    private string _LastName;

    public PersonType Type
    {
      get { return _Type; }
      set
      {
        if (_Type != value)
        {
          _Type = value;
          RaisePropertyChanged("Type");
        }
      }
    }
    private PersonType _Type;

    [DisplayFormat(DataFormatString="{0:d}")]
    public DateTime BirthDate
    {
      get { return _BirthDate; }
      set
      {
        if (_BirthDate != value)
        {
          _BirthDate = value;
          RaisePropertyChanged("BirthDate");
        }
      }
    }
    private DateTime _BirthDate;

    public bool VIP {get; set;}

    public ObservableCollection<String> Items {get; set;}


    

    



    [Display(AutoGenerateField=false)]
    public string InvisibleProperty { get { return "This property will not be visible in DetailsView by Default"; } }



    
    protected void RaisePropertyChanged(string propertyName)
    {
      if (PropertyChanged != null)
        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }

    public event PropertyChangedEventHandler PropertyChanged;

  }
}
